package org.jeecg.modules.upgrade.service.impl;

import org.jeecg.modules.upgrade.entity.TaskExeGroup;
import org.jeecg.modules.upgrade.entity.RelTaskExeGroupFunction;
import org.jeecg.modules.upgrade.mapper.RelTaskExeGroupFunctionMapper;
import org.jeecg.modules.upgrade.mapper.TaskExeGroupMapper;
import org.jeecg.modules.upgrade.service.ITaskExeGroupService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import java.io.Serializable;
import java.util.List;
import java.util.Collection;

/**
 * @Description: task_exe_group
 * @author: baochangrong
 * @Date:   2022-12-03
 * @Version: V1.0
 */
@Service
public class TaskExeGroupServiceImpl extends ServiceImpl<TaskExeGroupMapper, TaskExeGroup> implements ITaskExeGroupService {

	@Autowired
	private TaskExeGroupMapper taskExeGroupMapper;
	@Autowired
	private RelTaskExeGroupFunctionMapper relTaskExeGroupFunctionMapper;
	
	@Override
	@Transactional(rollbackFor = Exception.class)
	public void delMain(String id) {
		relTaskExeGroupFunctionMapper.deleteByMainId(id);
		taskExeGroupMapper.deleteById(id);
	}

	@Override
	@Transactional(rollbackFor = Exception.class)
	public void delBatchMain(Collection<? extends Serializable> idList) {
		for(Serializable id:idList) {
			relTaskExeGroupFunctionMapper.deleteByMainId(id.toString());
			taskExeGroupMapper.deleteById(id);
		}
	}
	
}
